package com.study.others.objectOpe;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

import org.junit.Test;

/**
* @Name: ObjectInputStreamDemo
* @Description: 对象反序列化测试类
* 构造：
* 	ObjectInputStream(InputStream in) 	创建从指定 InputStream 读取的 ObjectInputStream。
* @Author: 李超	lc_jack@foxmail.com
* @CreateDate: 2017-1-16 下午10:49:51 
* @Version: V1.0
 */
public class ObjectInputStreamDemo {
	
	@Test
	public void test() throws IOException, ClassNotFoundException {
		//创建对象反序列化流
		ObjectInputStream ois = new ObjectInputStream(new FileInputStream("object.txt")) ;
		//读取持久化对象二进制数据
		Person p = (Person) ois.readObject() ;
		System.out.println(p);
		//释放资源
		ois.close() ;
	}

}
